package com.hyz.advice;

import com.alibaba.excel.exception.ExcelAnalysisException;
import com.hyz.model.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.io.IOException;

/**
 * @author HGD
 * @date 2022/10/8 17:19
 */
@RestControllerAdvice
public class ProjectExceptionAdvice {
    @ExceptionHandler
    public ResponseResult<String> doException(IOException e) {
        return new ResponseResult<>(-1, "服务器故障，请稍后再试", "服务器故障，请稍后再试");
    }

    @ExceptionHandler
    public ResponseResult<String> doException(ExcelAnalysisException e) {
        return new ResponseResult<>(-1, "导入失败,请检查后再导入", "导入失败,请检查后再导入");
    }
}
